package com.ruoyi.security.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;


/**
 * @author yeoman
 * @description 证券节点枚举
 */
@Getter
@AllArgsConstructor
public enum SecurityNodeEnum {

    /**
     * 沪A股
     */
    SH_A("sh_a", SecurityTypeEnum.STOCK.getCode(), "沪A股"),
    /**
     * 深A股
     */
    SZ_A("sz_a", SecurityTypeEnum.STOCK.getCode(), "深A股"),
    /**
     * 京A股
     */
    HS_JBS("hs_bjs", SecurityTypeEnum.STOCK.getCode(), "京A股"),
    /**
     * 沪深京A股
     */
    HS_A("hs_a", SecurityTypeEnum.STOCK.getCode(), "沪深京A股"),
    /**
     * 创业板
     */
    CYB("cyb", SecurityTypeEnum.STOCK.getCode(), "创业板"),
    /**
     * 科创板
     */
    KCB("kcb", SecurityTypeEnum.STOCK.getCode(), "科创板"),
    /**
     * 沪市债券
     */
    SH_Z("sh_z_fenlei", SecurityTypeEnum.BOND.getCode(), "沪市债券"),
    /**
     * 深市债券
     */
    SZ_Z("sz_z_fenlei", SecurityTypeEnum.BOND.getCode(), "深市债券"),
    /**
     * 沪深债券
     */
    HS_Z("hs_z", SecurityTypeEnum.BOND.getCode(), "沪深债券"),


    ;

    private final String key;
    private final String type;
    private final String desc;

    public static String getType(String key) {
        for (SecurityNodeEnum value : SecurityNodeEnum.values()) {
            if (value.key.equals(key)) {
                return value.getType();
            }
        }
        return null;
    }

    public static String getDesc(String key) {
        for (SecurityNodeEnum value : SecurityNodeEnum.values()) {
            if (value.key.equals(key)) {
                return value.getDesc();
            }
        }
        return null;
    }

}
